<!-- Copyright (c) 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<polymer-element name="cr-settings-editor" attributes="settings errors disabled">
    <template>
        <link rel="stylesheet" href="../common/common.css">
        <link rel="stylesheet" href="../common/forms.css">

        <fieldset class="form-fields" disabled?="{{ disabled }}">
            <div class="form-row">
                <label class="form-label" for="name">Name</label>
                <div class="form-field">
                    <input type="text" id="name" value="{{ settings.name }}" autocomplete="off" class="{{ {invalid: errors.name} | tokenList }}">
                    <div class="form-error">{{ errors.name }}</div>
                </div>
            </div>
            <div class="form-row">
                <label class="form-label" for="notifyByChat">Notify by chat</label>
                <div class="form-field">
                    <input type="checkbox" id="notifyByChat" checked="{{ settings.notifyByChat }}" class="{{ {invalid: errors.notifyByChat} | tokenList }}">
                    <div class="form-error">{{ errors.notifyByChat }}</div>
                </div>
            </div>
            <div class="form-row">
                <label class="form-label" for="deprecatedUi">Deprecated UI</label>
                <div class="form-field">
                    <input type="checkbox" id="deprecatedUi" checked="{{ settings.deprecatedUi }}" class="{{ {invalid: errors.deprecatedUi} | tokenList }}">
                    <div class="form-error">{{ errors.deprecatedUi }}</div>
                </div>
            </div>
            <div class="form-row">
                <label class="form-label" for="displayExperimentalTryjobs">Display experimental tryjob results</label>
                <div class="form-field">
                    <input type="checkbox" id="displayExperimentalTryjobs" checked="{{ settings.displayExperimentalTryjobs }}" class="{{ {invalid: errors.displayExperimentalTryjobs} | tokenList }}">
                    <div class="form-error">{{ errors.displayExperimentalTryjobs }}</div>
                </div>
            </div>
            <div class="form-row">
                <label class="form-label" for="sendFromEmailAddress">Send replies from my email address</label>
                <div class="form-field">
                    <input type="checkbox" id="sendFromEmailAddress" checked="{{ settings.sendFromEmailAddress }}" class="{{ {invalid: errors.sendFromEmailAddress} | tokenList }}">
                    <div class="form-error">{{ errors.sendFromEmailAddress }}</div>
                </div>
            </div>
        </fieldset>
    </template>
    <script>
        Polymer({
            created: function() {
                this.settings = null;
                this.errors = {};
                this.disabled = false;
            },
        });
    </script>
</polymer-element>
